package com.bao.work;

import com.bao.work.classw.Student;

import java.util.ArrayList;

/**
 * @author baoye
 * @date 2024-07-29/18:35
 */
public class Work02 {
    public static void main(String[] args) {
        ArrayList<Student> sList = new ArrayList<>();
        sList.add(new Student("it001", "黄渤", 1.72));
        sList.add(new Student("it002", "孙红雷", 1.78));
        sList.add(new Student("it003", "章子怡", 1.64));
        sList.add(new Student("it004", "杨颖", 1.68));

        sList.forEach(s -> System.out.println(s));
        System.out.println("集合大小为:" + sList.size());
        Student s1 = sList.get(2);
        System.out.println("第三个:\n"+s1);

        sList.remove(3);
        System.out.println("集合大小为:" + sList.size());

        sList.set(0, new Student("it005", "撒贝宁", 1.67));
        System.out.println("1.70以上");
        sList.forEach(s -> {
            if (s.getHeight() > 1.70) {
                System.out.println(s);
            }
        });
        System.out.println("孙姓");
        sList.forEach(s -> {
            if (s.getName().startsWith("孙")) {
                System.out.println(s);
            }
        });


    }
}


